﻿using log4net;
using System;
using System.IO;
using System.Reflection;
using System.Web;
using AnyOffice.Components;
namespace AnyOffice.general.gzzd
{
    public partial class show_photo : ModulePage
    {
        private static ILog  log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Response.Buffer = true;
                Response.Clear();
                GzzdInfo gzzdInfo = GzzdFactory.GetGzzdInfo();
                if (gzzdInfo != null)
                {
                    string str = (Request.QueryString["filename"] != null) ? Request.QueryString["filename"].ToString() : "";
                    str = str.Replace("../", "").Replace("/", @"\");
                    FileInfo info2 = new FileInfo(gzzdInfo.DiskPath + str);
                    if (info2.Exists)
                    {
                        Response.ContentType = "image/jpeg";
                        Response.WriteFile(info2.FullName);
                    }
                }
            }
            catch (Exception exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("", exception);
                }
            }
        }
    }
}
